home *** CD-ROM | disk | FTP | other *** search
- surface expensive (float Ka = 1, Kd = 0.5, Ks = 0.5, roughness = 0.1;
- color specularcolor = 1;
- string bakename = "bake")
- {
- string objname = "";
- attribute ("identifier:name", objname);
- string passname = "";
- option ("user:pass", passname);
- float bakingpass = match ("bake", passname);
- color foo;
- if (bakingpass != 0) {
- foo = color noise(s*10,t*10);
- string bakefilename = concat (objname, ".", bakename, ".bake");
- bake (bakefilename, s, t, foo);
- } else {
- string filename = concat (objname, ".", bakename, ".tx");
- foo = color texture (filename, s, t);
- }
-
- color Ct = Cs * foo;
-
- normal Nf = faceforward (normalize(N),I);
- Ci = Ct * (Ka*ambient() + Kd*diffuse(Nf)) +
- specularcolor * Ks*specular(Nf,-normalize(I),roughness);
- Oi = Os; Ci *= Oi;
- }
-